/*
* @Author: shenyanqiu
* @Date:   2017-12-05 17:55:50
* @Last Modified by:   shenyanqiu
* @Last Modified time: 2017-12-05 19:30:43
*/
import configs from '../src/config';
import Mock from 'mockjs';

const { mockAPIPrefix } = configs;

let addressListData = Mock.mock({
  'data|80-100': [
    {
      id: '@id',
      name: '@cname',
      section: `新闻部`,
      job: '部长',
      tel:18380435488,
      sex:'男',
    },
  ],
});


let address = addressListData.data;

export default {

  [`GET ${mockAPIPrefix}/addresslist/list`] (req, res) {
    let { pageSize, page, ...otherArgs } = req.query;
    pageSize = pageSize || 10;
    page = page || 1;
    let data = address.slice((page-1)*pageSize, page*pageSize);
    setTimeout(function () {
      res.json({
        success: true,
        data: {
          list: data,
          total: address.length,
        },
      });
    },2000);

  },


};
